<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-bean" prefix="bean" %>
<%@ taglib uri="/struts-html" prefix="html" %>
<%@ taglib uri="/struts-logic" prefix="logic" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>欢迎来到龙岗区政府主办公益性职介所</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="/js/prototype-1.5.1.2.js" charset= "UTF-8"></script>
<script type="text/javascript">
//检查用户名是否存在
function checkLoginName(){
        var lname = document.all.loginName.value;
        if(lname=="" || lname.length<0){
        alert("\u5bf9\u4e0d\u8d77\uff0c\u7528\u6237\u540d\u4e0d\u80fd\u4e3a\u7a7a\uff01");
        document.all.loginName.value="";
        document.all.loginName.focus();
        }else{
    	var url = '/com/checkloginname.do';
        var pars = 'lname='+lname;
     
        var myAjax = new Ajax.Updater({success:'checkloginname'}, url, {method: 'get', parameters: pars});
        }
    	}
    //检查密码
	function checkPwd()
	{
		if (document.all.password.value != document.all.repassword.value){
			alert('\u5bf9\u4e0d\u8d77\uff0c\u4e24\u6b21\u8f93\u5165\u7684\u5bc6\u7801\u4e0d\u4e00\u81f4\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\uff01');
			document.all.password.value = "";
			document.all.repassword.value ="";
			document.all.password.focus();
		}
	}

//必填项
 function doMethod()
 {
    if(document.all.loginName.value==""){
    alert("对不起,用户名不能为空!");
    return false;
    }
    if(document.all.password.value==""){
    alert("对不起,密码不能为空!");
    return false;
    }
    if(document.all.email.value==""){
    alert("对不起,邮箱不能为空!");
    return false;
    }
    if(document.all.question.value==""){
    alert("对不起,问题不能为空!");
    return false;
    }
    if(document.all.answer.value==""){
    alert("对不起,问题答案不能为空!");
    return false;
    }
    
    document.forms[0].submit();
 }
</script>
<body>
<html:form action="/com/struts/web/user/register/reglogin">
<table width="880" border="1" align="center" cellpadding="0" cellspacing="0">
  <tr>
  <td>
  *用户名：
  </td>
  <td>
  <html:text property="loginName" styleId="loginName" onblur="checkLoginName()"/><div id="checkloginname"></div>
  </td>
  </tr>
  <tr>
  <td>
  *用户密码：
  </td>
  <td>
  <html:password property="password"/>
  </td>
  </tr>
  
  <tr>
                <td > 
				 *确认密码: 
				</td>
				<td><input type="password" onblur="checkPwd()" id="repassword"/></td>
              </tr>
   
   <tr>
  <td>
  *邮箱：
  </td>
  <td>
  <html:text property="email"/>
  </td>
  </tr>
  
  <tr>
  <td align = "center" colspan="2">
  申请密码保护
  </td>
  </tr>
  
  <tr>
  <td>*问题:
  </td>
  <td>
  <html:text property="question"/>
  </td>
  </tr>
  
  <tr>
  <td>*答案:
  </td>
  <td>
  <html:text property="answer"/>
  </td>
  </tr>
  
  <tr>
              <td colspan="2">
              <input type="button" value="保存－>下一步" style="cursor:hand" onclick="doMethod()"/>
              <input type="reset" value="重置"/>
              
              </td>
              </tr>
</table>
</html:form>
</body>
</html>
